<!-- 必须全局拥有唯一的id -->
<div id="templateSubscribe">
	<!-- 搜索栏 -->
    <el-form-q form="query" :field-data="queryFields" search-table="demoTable" :buttons="queryButtons"></el-form-q>
    <!-- 工具栏 -->
    <div class="yu-toolBar">
        <el-button-group>
            <el-button icon="add" @click="userSubscribe()" >消息订阅</el-button>
        </el-button-group>
    </div>
	<!-- 表格 -->
    <el-table-x ref="templateSubscribeTable"  :max-height="height"
                :data-url="urls.dataUrl" :table-columns="tableColumns">
    </el-table-x>

    <el-dialog :visible.sync="dialogVisible">
        <el-tag type="success">渠道类型：</el-tag>
        <el-radio v-for="item in channelTypes" v-model="channelType"  :label="item">{{channelTypeMap[item]}}</el-radio>　

        <br/> <br/>
        <el-tabs v-model="activeFlag" @tab-click="handleClick">
            <el-tab-pane label="用户订阅" name="first">
                <el-table-x ref="userTable" :max-height="mainGridFirst.height" :default-load="false" :pageable="false"
                            :checkbox="mainGridFirst.checkbox" :data-url="mainGridFirst.dataUrl"
                            :table-columns="mainGridFirst.tableColumns"></el-table-x>
                <div align="center">
                    <el-button type="primary" @click="saveUserSubscribe()">保存(用户)</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="岗位订阅" name="second">
                <el-table-x ref="dutyTable" :max-height="mainGridPost.height" :default-load="false" :pageable="false"
                            :checkbox="mainGridPost.checkbox" :data-url="mainGridPost.dataUrl"
                            :table-columns="mainGridPost.tableColumns"></el-table-x>
                <div align="center">
                    <el-button type="primary" @click="saveDutySubscribe()">保存(岗位)</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="角色订阅" name="third">
                <el-table-x ref="roleTable" :max-height="mainGridRole.height" :default-load="false" :pageable="false"
                            :checkbox="mainGridRole.checkbox" :data-url="mainGridRole.dataUrl"
                            :table-columns="mainGridRole.tableColumns"></el-table-x>
                <div align="center">
                    <el-button type="primary" @click="saveRoleSubscribe()">保存(角色)</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="机构订阅" name="fourth">
               <el-tree-x ref="orgUsertree" :show-checkbox="true" :height="mainGridPost.height" style="margin-top: 10px"
                           :data-url="orgUrl" data-id="orgId" data-label="orgName" :data-params="param"
                           data-pid="upOrgId" :data-root="orgRootId" :check-strictly="true"></el-tree-x>
                <div  align="center">
                    <el-button type="primary" @click="saveOrgSubscribe()">保存(机构)</el-button>
                </div>
            </el-tab-pane>
            <el-tab-pane label="关系订阅" name="fifth">
                <br/><br/>
                <el-form ref="form" :model="mainGridFifth" label-width="180px">
                    <el-form-item label="相对发送人员的关系">
                        <el-select v-model="mainGridFifth.Relationship" clearable >
                            <el-option label="同级机构人员" value="sameevel"></el-option>
                            <el-option label="上级机构人员" value="uplevel"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <div  align="center">
                    <el-button type="primary" @click="saveRelationshipSubscribe()">保存(关系)</el-button>
                </div>
            </el-tab-pane>
        </el-tabs>
    </el-dialog>
</div>